from configparser import ConfigParser
import json

cfg = ConfigParser()
read_ok = cfg.read('mysql.ini')

conf_dic = {}

for sec in cfg.keys():
    conf_dic[sec] = dict(cfg.items(sec))

print(json.dumps(conf_dic))


# 做得不错
